package com.xlh.enums;

import cn.hutool.core.util.StrUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * Excel枚举
 * <p>
 * Created by lx on 2019/2/24 0024.
 */
@Getter
@AllArgsConstructor
public enum ExcelTemplateEnum {

    TEACHER_COMMON("教师模板.xls", "import_teacher_common.xls", "教师通用模板", "TEACH_USU"),
    TEACHER_SPECIAL("教师模板.xls", "import_teacher_special.xls", "教师特殊模板", "TEACH_SPE"),
    STUDENT_COMMON("学生模板.xls", "import_student_common.xls", "学生通用模板", "STUDENT_USU"),
    COURSE_DIRECTION("课程体系.xls", "import_course_direction.xls", "课程体系", "COURSE_SYS"),
    CONCLUDE_STUDENT("课程目标学生导入模板.xls","import_conclude_student.xls", "课程目标学生模板", "CONCLUDE_STU_TEMP");

    private String name;
    private String fileName;
    private String remark;
    private String tempCode;

    public String getFilePath() {
        return StringUtils.join("excel", "/", fileName);
    }

    public static ExcelTemplateEnum getEnumByCode( String tempCode ){
        if(StrUtil.isBlank(tempCode)) return null;

        ExcelTemplateEnum[] values = ExcelTemplateEnum.values();
        for (ExcelTemplateEnum value : values) {
            if(tempCode.equals(value.getTempCode())){
                return value;
            }
        }
        return null;
    }




}
